The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
Changes 05
META.yml 22
README 14
inc/Module/Install/AuthorRequires.pm 54
inc/Module/Install/Base.pm 33
lib/Catalyst/Plugin/Unicode/Encoding.pm 220
t/06request_decode.t 113
7 files changed (This is a version diff) 1451
@@ -1,5 +1,10 @@
 Revision history for Perl extension Catalyst::Plugin::Unicode::Encoding
 
+0.9 2010-03-07 22:50:00
+        - Correctly decode UTF-8 URI Encoded (as per RFC3986) into
+          $c->request->arguments
+        - Test for this (u-foka)
+
 0.8 2010-01-11 13:36:16
         - Don't fail tests if we have an old version of URI::Escape
           installed.
@@ -9,7 +9,7 @@ build_requires:
 configure_requires:
   ExtUtils::MakeMaker: 6.42
 distribution_type: module
-generated_by: 'Module::Install version 0.91'
+generated_by: 'Module::Install version 0.910'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -28,4 +28,4 @@ requires:
 resources:
   license: http://dev.perl.org/licenses/
   repository: http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Plugin-Unicode-Encoding/
-version: 0.8
+version: 0.9
@@ -12,7 +12,7 @@ DESCRIPTION
 
 METHODS
     encoding
-        Returns a instance of a "Encode" encoding
+        Returns an instance of an "Encode" encoding
 
             print $c->encoding->name
 
@@ -24,6 +24,9 @@ OVERLOADED METHODS
         Decodes parameters, query_parameters, body_parameters and filenames
         in file uploads into a sequence of logical characters.
 
+    prepare_action
+        Decodes request arguments (i.e. "$c->request->arguments").
+
     setup
         Setups "$c->encoding" with encoding specified in
         "$c->config->{encoding}".
@@ -4,15 +4,14 @@ use warnings;
 
 package Module::Install::AuthorRequires;
 
+use base 'Module::Install::Base';
+
 # cargo cult
 BEGIN {
-    our $VERSION = '0.01';
+    our $VERSION = '0.02';
     our $ISCORE  = 1;
-#    our @ISA     = qw{Module::Install::Base};
 }
 
-use base qw/Module::Install::Base/;
-
 sub author_requires {
     my $self = shift;
 
@@ -36,4 +35,4 @@ sub author_requires {
 
 __END__
 
-#line 93
+#line 92
@@ -9,8 +9,8 @@ BEGIN {
 
 # Suspend handler for "redefined" warnings
 BEGIN {
-	my $w = $SIG{__WARN__};
-	$SIG{__WARN__} = sub { $w };
+#	my $w = $SIG{__WARN__};
+#	$SIG{__WARN__} = sub { $w };
 }
 
 #line 42
@@ -70,7 +70,7 @@ sub DESTROY {}
 
 # Restore warning handler
 BEGIN {
-	$SIG{__WARN__} = $SIG{__WARN__}->();
+#	$SIG{__WARN__} = $SIG{__WARN__}->();
 }
 
 1;
@@ -7,7 +7,7 @@ use Carp ();
 use Encode 2.21 ();
 
 use MRO::Compat;
-our $VERSION = '0.8';
+our $VERSION = '0.9';
 our $CHECK   = Encode::FB_CROAK | Encode::LEAVE_SRC;
 
 __PACKAGE__->mk_classdata('_encoding');
@@ -103,6 +103,20 @@ sub prepare_uploads {
     }
 }
 
+sub prepare_action {
+    my $c = shift;
+
+    my $ret = $c->next::method(@_);
+
+    my $enc = $c->encoding;
+
+    foreach (@{$c->req->arguments}) {
+        $_ = Encode::is_utf8( $_ ) ? $_ : $enc->decode( $_, $CHECK );
+    }
+
+    return $ret;
+}
+
 sub setup {
     my $self = shift;
 
@@ -141,7 +155,7 @@ logical characters. On response, encodes body into encoding.
 
 =item encoding
 
-Returns a instance of a C<Encode> encoding
+Returns an instance of an C<Encode> encoding
 
     print $c->encoding->name
 
@@ -160,6 +174,10 @@ Encodes body into encoding.
 Decodes parameters, query_parameters, body_parameters and filenames
 in file uploads into a sequence of logical characters.
 
+=item prepare_action
+
+Decodes request arguments (i.e. C<< $c->request->arguments >>).
+
 =item setup
 
 Setups C<< $c->encoding >> with encoding specified in C<< $c->config->{encoding} >>.
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 5 * 3;
+use Test::More tests => 6 * 3;
 use utf8;
 
 # setup library path
@@ -30,6 +30,8 @@ check_parameter(POST '/',
     ],
 );
 
+check_argument(GET "/$escape_str");
+
 
 sub check_parameter {
     my ( undef, $c ) = ctx_request(shift);
@@ -47,3 +49,13 @@ sub check_parameter {
     ok utf8::is_utf8($other_foo);
     is $other_foo => $decode_str;
 }
+
+sub check_argument {
+    my ( undef, $c ) = ctx_request(shift);
+    is $c->res->output => '<h1>It works</h1>';
+
+    my $foo = $c->req->args->[0];
+    ok utf8::is_utf8($foo);
+    is $foo => $decode_str;
+}
+